/**
 * 
 */
package net.phoenix.repository.dao;

/**
 * 
 * 
 * 
 * @author lixf
 * 
 * @version 2.0
 * 
 */
public class QDBName {

	// private static final String[] PREFIX = { "U", "S", "I", "L", "F", "D",
	// "B", "N", "P", "R", "W","U","M"};

	public static String encode(String name) {
		return "P_" + name.replace('-', '_').replace(':', '_');
	}

	public static String encode(int type, String name) {
		return encode(name);
	}

	/**
	 * Convert nodeDefinitionName to tableName;
	 * 
	 * @param property
	 * @return
	 */
	public static String toMysqlTableName(String nodeDefinitionName) {
		return '`' + nodeDefinitionName + '`';
	}

	/**
	 * Convert nodeDefinitionName to tableName;
	 * 
	 * @param property
	 * @return
	 */
	public static String toMysqlColumnName(String propertyName, int count) {
		return '`' + propertyName + '[' + count + ']' + '`';
	}

	/**
	 * Convert nodeDefinitionName to tableName;
	 * 
	 * @param property
	 * @return
	 */
	public static String toMysqlIndexName(String nodeDefinitionName, String propertyName, int count) {
		return "`idx_" + nodeDefinitionName + '_' + propertyName + '[' + count + ']' + '`';
	}
}
